﻿using Microsoft.AspNetCore.Mvc;
using UwinEducation.Shared.Models;

namespace UwinEducation.API.Controllers
{
    public class ApiControllerBase : Controller
    {
        protected IActionResult Ok<T>(T data, string message = "操作成功")
        {
            return new JsonResult(new ApiResponse<T>()
            {
                Code = 200,
                Message = message,
                Data = data
            });
        }
        protected IActionResult Error<T> (string message, int code = 500)
        {
            return new JsonResult(new ApiResponse<T>()
            {
                Code = code,
                Message = message
            });
        }
    }
}
